package com.github.abel533.postprocessor.base;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.Configuration;

import static com.github.abel533.C.print;

@Configuration
public class BeanPostProcessorImpl implements BeanFactoryPostProcessor, BeanPostProcessor {

    /**
     * BeanFactoryPostProcessor
     */
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        print("BeanFactoryPostProcessor#postProcessBeanFactory");
    }

    //<editor-fold desc="BeanPostProcessor">
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        print("BeanPostProcessor#postProcessBeforeInitialization - " + beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        print("BeanPostProcessor#postProcessAfterInitialization - " + beanName);
        return bean;
    }
    //</editor-fold>


}
